Skip to content

bpo-36531: Only count number of members once in PyType_FromSpec#12691

Merged
DinoV merged 1 commit intopython:masterfrom
eduardo-elizondo:fix-members-count
May 6, 2019
Merged

bpo-36531: Only count number of members once in PyType_FromSpec#12691
DinoV merged 1 commit intopython:masterfrom
eduardo-elizondo:fix-members-count

Conversation

@eduardo-elizondo
Copy link
Contributor

@eduardo-elizondo eduardo-elizondo commented Apr 4, 2019

If a user accidentally defined more than one Py_tp_members in the spec, PyType_FromSpec will ignore all but the last use case. However, the number of members count will cause the type to allocate more memory than needed. This leads to weird behavior and crashes.

This is a simple one line solution to make the type initialization safer.

https://bugs.python.org/issue36531

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants